from rest_framework.pagination import PageNumberPagination
from rest_framework.response import Response


class PageNum(PageNumberPagination):
    page_size = 10

    def get_paginated_response(self, data):
        return Response({
            #当前总条数
            'counts':self.page.paginator.count,
            'lists':data,
            "page": self.page.number,
            "pages": self.page.paginator.num_pages,
            "pagesize": self.page_size
        })
